import React, { Component } from 'react'
import {Map} from 'immutable'

export default class App extends Component {
  state = {
    obj:Map({
        name:'miaohao',
        age:'23',
        filter:Map({
            ername:'haozai',
            erage:'25'
        })
    })
  }

  render() {
    return (
      <div>
        <button onClick={()=>{
            this.setState({
                obj: this.state.obj.set('name','dawang')
            })
        }}>button</button>
        <Child filter={this.state.obj.get('filter')}></Child>
        {this.state.obj.get('name')}
      </div>
    )
  }
}

class Child extends Component {
    shouldComponentUpdate(nextProps, nextState){
        if(this.props.filter === nextProps.filter)
            return false
        else
            return true
    }
    componentDidUpdate(){
        console.log('更新了')
    }
    render(){
        return(
            <div>
                {console.log(this.props.filter)}
            </div>
        )
    }
}
